
function edit(id){
	var url = 'edit_employee.html?'+id;
	var config = 'dialogWidth:240px;dialogHeight:235px;scroll:no;status:no;';
	window.showModalDialog(url,'',config);
//	window.open(url,'',config);
	selectEmployee();
};

function selectEmployee(){
	var emp_name = escape(escape(document.getElementById('emp_name').value));
	var emp_job = escape(escape(document.getElementById('emp_job').value));
	var emp_state = escape(escape(document.getElementById('emp_state').value));
	emp_job = emp_job==''?-1:emp_job;
	emp_state = emp_state==''?0:emp_state;
	
	var url = '/storage/admin/pages/employee.do?method=selectEmployee&d=' + new Date();
	url = url + '&emp_name='+emp_name;
	url = url + '&emp_job='+emp_job;
	url = url + '&emp_state='+emp_state;
	
	$.getJSON(url, {}, function(data){
		$('#empList').html('');

		var _max = get_max_line(470,25);
		
		for(var i=0;i<data.length;i++){
			var style_border = 0-(0-i-1)==data.length&&data.length>=_max?'style="border-bottom:0;"':'';
			var empList = '';
			empList = empList + '<tr style="height:25px;" onmouseover="cbgcolor(this,0)" onmouseout="cbgcolor(this,1)">';
			empList = empList + '  <td class="list" '+style_border+' width="100" >'+data[i][1]+'</td>';
			empList = empList + '  <td class="list" '+style_border+' width="150" >'+data[i][2]+'</td>';
			empList = empList + '  <td class="list" '+style_border+' width="70" >'+data[i][3]+'</td>';
			empList = empList + '  <td class="list" '+style_border+' width="50" >'+(data[i][4]==0?'在岗':'离岗')+'</td>';
			empList = empList + '  <td class="list" '+style_border+' width="110" >'+data[i][5]+'</td>';
			empList = empList + '  <td class="list" '+style_border+' width="" >'+data[i][6]+'</td>';
			empList = empList + '  <td class="list" '+style_border+' width="50" ><a href="javascript:void(0)" onclick="edit('+data[i][0]+')">编辑</a></td>';
			empList = empList + '</tr>';
			$('#empList').append(empList);
		}
		if(data.length<_max){
			add_foot();
		}
	});
};

function add_foot(){
	var foot = '';
    foot = foot + '<tr>';
	foot = foot + '  <td class="list" style="border-bottom:0;" width="100" >&nbsp;</td>';
	foot = foot + '  <td class="list" style="border-bottom:0;" width="150" >&nbsp;</td>';
	foot = foot + '  <td class="list" style="border-bottom:0;" width="70" >&nbsp;</td>';
	foot = foot + '  <td class="list" style="border-bottom:0;" width="50" >&nbsp;</td>';
	foot = foot + '  <td class="list" style="border-bottom:0;" width="110" >&nbsp;</td>';
	foot = foot + '  <td class="list" style="border-bottom:0;" width="" >&nbsp;</td>';
	foot = foot + '  <td class="list" style="border-bottom:0;" width="50" >&nbsp;</td>';
	foot = foot + '</tr>';
	$('#empList').append(foot);
};
